<?php
namespace app\admin\controller;
use app\index\model\User as UserModel;
use think\Controller;
class User extends Common{

	public function userlist()
	{

		$where = [];

		input('nickname') && $where['nickname'] = ['like','%'.input('nickname').'%'];


		if(input('start') && input('end')){
			$where['create_time'] = [
				['>=',strtotime(input('start'))],
				['<=',strtotime(input('end'))+86400]
			];
		}else if(input('start')){
			$where['create_time'] = ['>=',strtotime(input('start'))];
		}else if(input('end')){
			$where['create_time'] = ['<=',strtotime(input('end'))+86400];
		}

		$users = UserModel::where($where)->paginate(5);
		$this->assign('users',$users);
		return $this->fetch();
	}

	public function del()
	{
		$user_id = input('user_id');

		$res = UserModel::destroy($user_id);

		if($res){
			$this->success("删除成功");
		}else{
			$this->error("删除失败");
		}
	}

	public function edit()
	{
		$user_id = input('user_id');

		var_dump($user_id);
	}

}